package org.hibernate.test.service;

import java.util.List;

import org.hibernate.test.dao.RolDao;
import org.hibernate.test.dto.RolDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service("rolService")
@Transactional(propagation = Propagation.REQUIRED)
public class RolService implements IService<RolDto> {

	@Autowired(required = false)
	@Qualifier("rolRepository")
	private RolDao rolRepository;

	@Override
	public List<RolDto> listAll() {
		return rolRepository.listAll();
	}

	@Override
	public RolDto getById(Long id) {
		return rolRepository.getById(id);
	}

	@Override
	public RolDto saveOrUpdate(RolDto rol) {
		return rolRepository.saveOrUpdate(rol);
	}

	@Override
	public void delete(RolDto rol) {
		rolRepository.delete(rol);
	}

	@Override
	public Integer count() {
		return rolRepository.count();
	}

}
